package com.songbl.bless.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songbl.bless.app.dao.BlessInfoDao;
import com.songbl.bless.app.entity.BlessInfo;
import com.songbl.bless.app.service.BlessInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("blessInfoService")
public class BlessInfoServiceImpl extends ServiceImpl<BlessInfoDao, BlessInfo> implements BlessInfoService {


    @Override
    public Boolean addBlessInfo(BlessInfo contactsEntity) {
        int insert = baseMapper.insert(contactsEntity);
        return insert==1;

    }

    @Override
    public List<BlessInfo> getBlessInfos(int id) {
        QueryWrapper queryWrapper =  new QueryWrapper();
        queryWrapper.eq("user_id",id);
        List<BlessInfo> blessInfos = baseMapper.selectList(queryWrapper);
        return blessInfos;
    }

    @Override
    public BlessInfo getBlessOneInfo(int infoId) {
        BlessInfo blessInfo = baseMapper.selectById(infoId);
        return blessInfo;
    }
}
